
local guac = require 'guac'
local bass = require 'bindings.bass'
local alienex = require 'alienex'
require 'guac.bass_setup'
local error, newproxy, setmetatable, print
    = error, newproxy, setmetatable, print


module (...)


local music_proto = {}
local music_meta = {__index = music_proto}

function loadfile(path)
  local hmusic = bass.MusicLoad(0, path, alienex.lohi2double(0, 0), 0, 0, 0)
  return setmetatable({hmusic = hmusic}, music_meta)
end

function music_proto:play()
  bass.ChannelPlay(self.hmusic, 1)
end

function music_proto:volume(new)
  bass.ChannelSetAttribute(self.hmusic, bass.ATTRIB_VOL, new)
end
